<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>while简单案例</title>
</head>
<body>
    <script>
        // 计算1-100的整数和
        var n = 1;
        var sum = 0; 
        while (n<=100){
            // sum += n;
            console.log(`${n} + ${sum} = ${sum+=n}`);
            n++;
        }
        console.log(sum);

        // 2、弹出提示框 你很会打吗 如果输入 是 就提示 会打有屁用啊 否则，一直执行
         var str = prompt('你很会打吗？');
            while (str !== '是'){
                    str = prompt('你很会打吗？');
            }
            alert('你会打有屁用啊，出来混是要讲势力，是要讲背景');

    </script>
</body>
</html>